package com.atguigu.pojo;

import java.util.List;

/**
 * page是分页的模型对象
 * @param <T>是具体的模块javaBean类
 */
public class Page<T> {
    public static final Integer PAGE_SIZE=4;

    //当前页码
    private Integer pageNo;
    //总页码
    private Integer pageTotal;
    //当前页显示数据
    private Integer pagesize=PAGE_SIZE;
    //总记录数
    private Integer getPageTotalCount;
    //当前页数据
    private List<T> items;

    //分页条的请求地址
    private String url;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        /* 数据边界的有效检查 */
        if(pageNo<1){
            pageNo=1;
        }if(pageNo>pageTotal){
            pageNo=pageTotal;
        }
        this.pageNo = pageNo;
    }

    public Integer getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(Integer pageTotal) {
        this.pageTotal = pageTotal;
    }

    public Integer getPagesize() {
        return pagesize;
    }

    public void setPagesize(Integer pagesize) {
        this.pagesize = pagesize;
    }

    public Integer getGetPageTotalCount() {
        return getPageTotalCount;
    }

    public void setGetPageTotalCount(Integer getPageTotalCount) {
        this.getPageTotalCount = getPageTotalCount;
    }

    public List<T> getItems() {
        return items;
    }

    public void setItems(List<T> items) {
        this.items = items;
    }

    @Override
    public String toString() {
        return "Page{" +
                "pageNo=" + pageNo +
                ", pageTotal=" + pageTotal +
                ", pagesize=" + pagesize +
                ", getPageTotalCount=" + getPageTotalCount +
                ", items=" + items +
                ", url='" + url + '\'' +
                '}';
    }
}
